package com.pine.admin.modules.system.service;



import com.pine.common.dto.Page;
import com.pine.common.excelutil.ExcelPoiUtil;
import com.pine.common.utils.DateTimeTool;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;

@Service
@Slf4j
public class ExcelPoiService {


    /**
     * 导出商家全部订单
     * */
    public void ExportAllShopOrderInfo(HttpServletRequest request, HttpServletResponse response, Page page, Object record) {


        String param = request.getParameter("param");
        log.info("ExportAllShopOrderInfo");
        try {
            Map<String, Object> parameter = new HashMap<String, Object>();
            page.setPageNumber(1000000000);
            parameter.put("record", record);
            parameter.put("page", page);
            parameter.put("param", param);
            List<Object> companyInfoEntities = new ArrayList<>();

            //定义导出excel的名字
            String excelName="报名信息-智联招聘"+"-" + DateTimeTool.dateTimeToStr(new Date());
            // 获取需要转出的excle表头的map字段
            LinkedHashMap<String, String> fieldMap =new LinkedHashMap<String, String>() ;

            fieldMap.put("coNameCn", "企业名称（中文）");
            fieldMap.put("coSimNameCn","企业简称（中文）");
            fieldMap.put("coNameEn","企业名称（英文）");
            fieldMap.put("coSimNameEn","企业简称（英文）");

            fieldMap.put("coAllowName", "统一对外名称");
            fieldMap.put("area.arName", "区域");
            fieldMap.put("industry.name", "行业");
            fieldMap.put("scale.name", "规模");
            fieldMap.put("signTime", "参选时间");
            fieldMap.put("foundingTime", "成立时间");
            fieldMap.put("coAddress", "公司地址");
            fieldMap.put("coNature", "公司性质");
            fieldMap.put("coContactName", "公司负责人信息");
            fieldMap.put("coPost", "公司负责人岗位");
            fieldMap.put("coContactPhone", "公司负责人电话");

            fieldMap.put("coContactEmail", "公司负责人邮箱");
            fieldMap.put("coContactTell", "公司负责人固话");

            fieldMap.put("isPotential", "中国最具发展潜力雇主");
            fieldMap.put("isBest", "中国年度最佳全国雇主100强");
            fieldMap.put("isDuty", "中国年度最具社会责任雇主");
            fieldMap.put("isWisdom", "中国年度最具智造精神雇主");
            fieldMap.put("coPost", "城市最佳雇主city");
            fieldMap.put("qianLiCity","中国年度城市最具发展潜力雇主奖项");
            fieldMap.put("isCityBest", "最佳雇主HR提名");



            //导出银行提现对账记录
            ExcelPoiUtil.export(excelName, companyInfoEntities, fieldMap, response);
        } catch (Exception e) {
            log.error("ExportAllShopOrderInfo", e);
        }
    }

}
